using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MyHunter.Tools
{
    public partial class BackUp : Form
    {
        #region CTOR
        public BackUp(DataSchema.CollectionSchema.BackupDataTable t)
        {
            InitializeComponent();
            this.collectionSchema_BackupDataTableBindingSource.DataSource = t;
            if(collectionSchema_BackupDataTableBindingSource.List.Count == 0)
                collectionSchema_BackupDataTableBindingSource.AddNew();
        }
        #endregion

        #region PRIVATE
        private bool ValidateMe()
        {
            if(this.labelCollPath.Text == "")
            {
                MessageBox.Show("You have to enter BackupFolder");
                return false;
            }
            return true;
        }
        #endregion

        #region EVENTS
        private void btnBackUpFolder_Click(object sender, EventArgs e)
        {
            if(this.folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.labelCollPath.Text = folderBrowserDialog.SelectedPath;
            }

        }
        
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if(ValidateMe())
            {
                collectionSchema_BackupDataTableBindingSource.EndEdit();
                this.Close();
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if(ValidateMe())
            {
                collectionSchema_BackupDataTableBindingSource.EndEdit();
                this.Close();
            }
        }
        #endregion


    }
}